﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Active.Core;

public partial class System_Setting : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        { 
            txtAddress.Text = CompanySettings.Instance.Address;
            txtFax.Text = CompanySettings.Instance.Fax;
            txtName.Text = CompanySettings.Instance.Name;
            txtPostalcode.Text = CompanySettings.Instance.Postalcode;
            txtTel.Text = CompanySettings.Instance.Tel;
        }
        this.btnSaveSetting.Visible = CompanySettings.Instance.CanEdit();
    }

    protected void btnSaveSetting_Click(object sender, EventArgs e)
    {
        CompanySettings.Instance.Address = txtAddress.Text;
        CompanySettings.Instance.Fax = txtFax.Text;
        CompanySettings.Instance.Name = txtName.Text;
        CompanySettings.Instance.Postalcode = txtPostalcode.Text;
        CompanySettings.Instance.Tel = txtTel.Text;
        CompanySettings.Instance.Save();
    }
}
